package chu.dejian.entity;

import java.util.ArrayList;
import java.util.List;

import chu.dejian.widget.AttentionLevelView;

/**
 * Created by Administrator on 2016/7/1 0001.
 */
public class AttendeeEntity {
    public int atid;
    public String attendeeId;
    public String attendeeName;
    public AttentionLevelView.ATTENTION_LEVEL attenderLevel;
    public AttentionLevelView.ATTENTION_LEVEL attendeeLevel;

    public static ContactEntity convertToContactEntity(AttendeeEntity attendeeEntity){
        return new ContactEntity(attendeeEntity.attendeeName,attendeeEntity.attendeeId,attendeeEntity.attendeeLevel);
    }

    public static List<ContactEntity> convertToContactEntity(List<AttendeeEntity> attendeeEntityList){
        if(attendeeEntityList == null) return null;
        List<ContactEntity> contactEntities = new ArrayList<>();
        for(AttendeeEntity attendeeEntity : attendeeEntityList){
            contactEntities.add(AttendeeEntity.convertToContactEntity(attendeeEntity));
        }
        return contactEntities;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof AttendeeEntity)) return false;

        AttendeeEntity that = (AttendeeEntity) o;

        if (atid != that.atid) return false;
        if (!attendeeId.equals(that.attendeeId)) return false;
        if (!attendeeName.equals(that.attendeeName)) return false;
        if (attenderLevel != that.attenderLevel) return false;
        return attendeeLevel == that.attendeeLevel;
    }

    @Override
    public int hashCode() {
        int result = atid;
        result = 31 * result + attendeeId.hashCode();
        result = 31 * result + attendeeName.hashCode();
        result = 31 * result + attenderLevel.hashCode();
        result = 31 * result + attendeeLevel.hashCode();
        return result;
    }
}
